<%--
  Created by IntelliJ IDEA.
  User: 86184
  Date: 2022/10/19
  Time: 10:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>用户角色管理-角色管理</title>
    <link rel="shortcut icon" href="${pageContext.request.contextPath}../../static/images/system.ico">
    <link rel="stylesheet" href="${pageContext.request.contextPath}../../static/css/pages/user_list.css">
    <script src="${pageContext.request.contextPath}../../static/scripts/jquery_3.6_min.js"></script>
    <script src="${pageContext.request.contextPath}../../static/js/role_list.js"></script>
</head>
<body>
<%@include file="header.jsp"%>
<div class="userManage w">
    <div class="user-left">
        <%@include file="menu_left.jsp"%>
    </div>
    <div class="user-right">
        <div class="user_title">
            <h4>系统管理&nbsp;>&nbsp;角色管理</h4>
        </div>
        <div class="user-search">
            <form name="getSearchRoles" action="${pageContext.request.contextPath}/searchRole/${username}/1" method="get">
                <input type="text" name="name" placeholder="角色名" value="${searchRoleName}" class="inp-search">
                <input type="submit" class="user-search-search" value="查询"/>
                <a href="#" class="user-search-add">添加</a>
            </form>
        </div>
        <table class="user-table">
            <thead>
                <tr>
                    <th><input type="checkbox" name="ids" id="ids"></th>
                    <th>序号</th>
                    <th>角色名字</th>
                    <th>角色描述</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <c:forEach var="role" items="${page.list}"  varStatus="status">
                    <tr>
                        <td><input type="checkbox"></td>
                        <td>${status.count}</td>
                        <td>${role.name}</td>
                        <td>${role.description}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/getRole/${role.id}/${username}" class="user-change">修改</a>
                            <a href="${pageContext.request.contextPath}/deleteRole/${role.id}/${username}" class="user-delete">删除</a>
                        </td>
                    </tr>
                </c:forEach>
                <c:if test="${isGetPage}">
                    <tr>
                        <td colspan="6">
                            <c:if test="${page.hasPreviousPage}">
                                <a href="${pageContext.request.contextPath}/getRolePage/1/${username}">首页</a>
                            </c:if>
                            <c:if test="${page.hasPreviousPage}">
                                <a href="${pageContext.request.contextPath}/getRolePage/${page.prePage}/${username}">上一页</a>
                            </c:if>
                            <c:forEach items="${page.navigatepageNums}" var="num">
                                <c:if test="${page.pageNum == num}">
                                    <a style="color: red" href="${pageContext.request.contextPath}/getRolePage/${num}/${username}">${num}</a>
                                </c:if>
                                <c:if test="${page.pageNum != num}">
                                    <a href="${pageContext.request.contextPath}/getRolePage/${num}/${username}">${num}</a>
                                </c:if>
                            </c:forEach>
                            <c:if test="${page.hasNextPage}">
                                <a href="${pageContext.request.contextPath}/getRolePage/${page.nextPage}/${username}">下一页</a>
                            </c:if>
                            <c:if test="${page.hasNextPage}">
                                <a href="${pageContext.request.contextPath}/getRolePage/${page.pages}/${username}">末页</a>
                            </c:if>
                        </td>
                    </tr>
                </c:if>
                <c:if test="${isGetRolePage}">
                    <tr>
                        <td colspan="6">
                            <c:if test="${page.hasPreviousPage}">
                                <a href="${pageContext.request.contextPath}/searchRole/${username}/1?name=${searchRoleName}">首页</a>
                            </c:if>
                            <c:if test="${page.hasPreviousPage}">
                                <a href="${pageContext.request.contextPath}/searchRole/${username}/${page.prePage}?name=${searchRoleName}">上一页</a>
                            </c:if>
                            <c:forEach items="${page.navigatepageNums}" var="num">
                                <c:if test="${page.pageNum == num}">
                                    <a style="color: red" href="${pageContext.request.contextPath}/searchRole/${username}/${num}?name=${searchRoleName}">${num}</a>
                                </c:if>
                                <c:if test="${page.pageNum != num}">
                                    <a href="${pageContext.request.contextPath}/searchRole/${username}/${num}?name=${searchRoleName}">${num}</a>
                                </c:if>
                            </c:forEach>
                            <c:if test="${page.hasNextPage}">
                                <a href="${pageContext.request.contextPath}/searchRole/${username}/${page.nextPage}?name=${searchRoleName}">下一页</a>
                            </c:if>
                            <c:if test="${page.hasNextPage}">
                                <a href="${pageContext.request.contextPath}/searchRole/${username}/${page.pages}?name=${searchRoleName}">末页</a>
                            </c:if>
                        </td>
                    </tr>
                </c:if>
            </tbody>
        </table>
    </div>

<%--    添加表单--%>
    <div class="user-add-form">
        <div class="user_title">
            <h4>系统管理&nbsp;>&nbsp;角色管理&nbsp;>&nbsp;添加角色</h4>
        </div>
        <form class="user-form" style="position: relative" name="roleAddForm" action="${pageContext.request.contextPath}/addRole/${username}" method="post">
            <label for="role_name" class="lbl"><span class="color_red">*</span>角色名称：</label><input type="text" id="role_name" name="name" class="user-inp" placeholder="role名称"> <br/>
            <label for="desc" style="position: relative; left: 0; top: -60px" class="lbl"><span class="color_red">*</span>角色描述：</label><textarea id="desc" name="description" class="user-inp" style="font-size: 14px;color:#000;height: 100px!important;resize: none" placeholder="role描述"></textarea><br/>
            <input type="submit" value="添加" class="btn-add">
            <a href="${pageContext.request.contextPath}/getRolePage/1/${username}" class="btn-return">返回</a>
        </form>
    </div>
</div>
</body>
</html>
